<?php
    //include banner images from database
    include_once '../icloud_files/models/AdvModel.php';
    $banners = new AdvModel();
    $banners->get_adv_lists('banner_pics');
    //echo "<pre>" . print_r($banners->lists['banner_pics'], true) . "</pre>";

    if(!isset($_SESSION['banner_id'])) {
        $_SESSION['banner_id'] = mt_rand(0, count($banners->lists['banner_pics'])-1); //current banner
    }
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <meta name="author" content="forafreeworld.com"/>
    <meta name="description" content="up to 250 words"/>
    <meta name="Keywords" content="up to 20 words"/>
    <meta name="googlebot" content="all"/>
    <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
    <link rel="icon" href="favicon.ico" type="image/x-icon">
    <title><?php echo $data->page_title;?></title>

   <!--[if IE 8]>
<link href="css/ie8_styles.css" media="screen" type="text/css" rel="stylesheet" />
<![endif]-->

    <!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <link href="css/lightbox.css" type="text/css" rel="stylesheet" />

    <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
    <script src="js/main.js"></script>
    <script src="js/pagination.js"></script>
    <script src="js/lightbox-2.6.min.js"></script>

    <!-- GOOGLE ANALYTICS -->
    <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-45637344-5', 'ahimeh.com');
        ga('send', 'pageview');

    </script>
</head>
<body>

<div id="fb-root"></div>
<script>(function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>

<!-- WEB  -->
<header id="container_header">
    <div id="mini_header_holder">
        <div id="mini_header">
            <div class="fb-like" data-href="http://www.ahimeh.com/" data-layout="standard" data-action="like" data-show-faces="false" data-share="true" data-colorscheme="dark"></div>
            <div id="mini_header__buttons_holder">
            <?php if (isset($_SESSION) && $_SESSION['is_logged'] === true) {
                echo "<div class='mini_header_buttons_logged'>Welcome, ".
                    $_SESSION['user_data']['username'].". <div class='logout_link red'><a href='?p=logout'>Logout</a></div></div>";
            } else {
                ?>
                <div class="mini_header_buttons">
                    <div id="signup_button">
                        <a href="?p=register"><img src="img/free_signup.png" alt="sign up"></a>
                    </div>
                </div>
                <div class="mini_header_buttons">
                    <div class="or">
                        <p>
                            or
                        </p>
                    </div>
                </div>
                <div class="mini_header_buttons">
                    <div id="log_in">
                        <a href="?p=login"><img src="img/log_in.png" alt="log in"></a>
                    </div>
                </div>
                <?php
            }
            ?>

            </div>
        </div>
    </div>
    <div id="bigger_header_holder">
        <div id="bigger_header">
            <div id="logo">
                <h1><a href="?"><img src="img/ahimeh_auto_logo.png" alt="Ahimeh Auto Center"></a></h1>
            </div>
            <nav id="container_nav">
                <ul>
                    <li><a <?php echo (!isset($_GET['p']) ? 'class="container_nav_clicked"' : '');?> href="?">Find Autos</a></li>
                    <li><a <?php echo ($_GET['p'] === 'index_parts' ? 'class="container_nav_clicked"' : '');?> href="?p=index_parts">Find Parts</a></li>
                    <li id="special_li">
                        <span id="sell_your">Sell Your</span>
                        <span class="style_car_li"><a <?php echo ($_GET['p'] === 'adv_add' ? 'class="container_nav_clicked style_car_clicked"' : '');?> href="?p=adv_add">Auto</a></span> |
                        <span class="style_part_li"><a <?php echo ($_GET['p'] === 'adv_add_parts' ? 'class="container_nav_clicked style_part_clicked"' : '');?> href="?p=adv_add_parts">Part</a></span>
                    </li>
                    <li><a <?php echo ($_GET['p'] === 'dealer_search' ? 'class="container_nav_clicked"' : '');?> href="?p=dealer_search">Auto Service Center</a></li>
                    <li><a <?php echo ($_GET['p'] === 'about' ? 'class="container_nav_clicked"' : '');?> href="?p=about">Contact Us</a></li>
                </ul>
            </nav>
            
              <div id="add_left">
        
        <img src="<?php echo $banners->lists['banner_pics'][$_SESSION['banner_id']];?>" alt="">
        
    </div>
        <div id="add_right">
        
        <img src="<?php echo $banners->lists['banner_pics'][$_SESSION['banner_id']];?>" alt="">
        
    </div>
        
        
        </div>
    </div>
  
</header>
<div id="notifications">
    <!-- this area is filled in with server messages -->
    <ul>
        <?php
            if(!empty($data->messages)) {
                foreach ($data->messages as $v) {
                    echo "<li>".$v."</li>";
                }
            }

        ?>
    </ul>
</div>